﻿@{
    ViewBag.Title = ViewBag.CurBlogUserName + "的主页 - 小博客";
    Layout = "~/Views/Shared/_BlogLayout.cshtml";
}
@using MyBlog
@{
    var articles = ViewBag.Articles as List<ArticleModel>;
    var moods = ViewBag.Moods as List<MoodModel>;
    var msgs = ViewBag.Msgs as List<MessageModel>;
    var blogUser = ViewBag.blogUser as AccountModel;
}

<div style="padding:5px">
    <div class="index-left">
        <div class="top_ptitle">
            随笔推荐
        </div>
        @if (articles.Default().Count() > 0)
            {
                foreach (var item in articles)
                {
                <div class="article-item">
                    <div class="blogs">
                        <h3><a href="@Url.Action("article/"+item.ID)">@(item.IsTop ? "[置顶]" + item.Title : item.Title)</a></h3>
                        <p>@(string.IsNullOrWhiteSpace(item.Profile) ? item.Content.StripHTML().SubStr(500) : item.Profile)</p>
                        <a class="read-all" href="@Url.Action("article/"+item.ID)">阅读全文</a>
                        <div class="index-article-tip">
                            <div class="index-article-tags">
                                <i class="icon-tags"></i> 标签：
                                @if (item.TagModels.Count > 0)
                                {
                                    foreach (var t in item.TagModels)
                                    {
                                        <a title="查看标签为[@(t.TagName)]的文章" href="@Url.Action("articles",new {tagID=t.ID })">@t.TagName</a>
                                    }
                                }
                                else
                                {
                                    @:暂无标签
                }
                            </div>
                            <div class="autor">
                                <span><i class="icon-time"></i> @item.CreateTime.ToString("yyyy-MM-dd HH:mm")</span>
                                <span><i class="icon-comments"></i> 评论(<a href="@Url.Action("article/"+item.ID)">@item.ArticleCommentModels.Count</a>)</span>
                                <span><i class="icon-eye-open"></i> 阅读(<a href="@Url.Action("article/"+item.ID)">@item.ReadCount</a>)</span>
                            </div>
                        </div>
                    </div>
                </div>
            }
            <div class="see-more"><a href="@Url.Action("articles")">查看更多</a></div>
        }
        else
        {
            if (UserSession.LoginUserInfo != null && UserSession.AccountId.Same(blogUser.Account))
            {
                <span class="dv-none-tip">暂无随笔~现在去 <a href="@Url.Action("release")"><i class="icon-edit"></i>发布</a></span>
            }
            else
            {
                <span class="dv-none-tip">博主很懒，暂时还没有写过随笔~</span>
            }
        }
        <div class="top_ptitle">
            说说动态
        </div>
        @if (moods.Default().Count() > 0)
            {
                foreach (var item in moods)
                {
                <div class="article-item">
                    <div class="blogs">
                        <p>@item.Content.StripHTML().SubStr(100)&nbsp;<a class="see" href="@Url.Action("index","mood")/#m-@item.ID">查看</a></p>
                        <div>
                            <div class="autor">
                                <span><i class="icon-time"></i> @item.CreateTime.ToString("yyyy-MM-dd HH:mm")</span>
                                <span><i class="icon-comments"></i> 评论(<a href="@Url.Action("index","mood")/#m-@item.ID">@item.MoodCommentModels.Count</a>)</span>
                                <span>
                                    <i class="icon-heart"></i> 赞(<a href="@Url.Action("index","mood")/#m-@item.ID">@item.AgreeCount</a>)
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            }
            <div class="see-more"><a href="@Url.Action("index","mood")">查看更多</a></div>
        }
        else
        {
            if (UserSession.LoginUserInfo != null && UserSession.AccountId.Same(blogUser.Account))
            {
                <span class="dv-none-tip">暂无动态~现在去 <a href="@Url.Action("index","mood")"><i class="icon-edit"></i>发布</a></span>
            }
            else
            {
                <span class="dv-none-tip">博主很懒，暂时还没有发表过说说~</span>
            }
        }
        <div class="top_ptitle">
            留言动态
        </div>
        @if (msgs.Default().Count() > 0)
        {
            foreach (var item in msgs)
            {
                <div class="article-item">
                    <div class="blogs">
                        <p>
                            <span class="spuid">@(WebCache.GetNickName(item.VisitUid))</span>@(UserSession.LoginUserInfo != null && UserSession.AccountId.Same(blogUser.Account) ? "给我留言：" : "给他留言：")
                            @item.Content.StripHTML().SubStr(100)
                            &nbsp;<a class="see" href="@Url.Action("index","message")/#m-@item.ID">查看</a>
                        </p>
                        <div>
                            <div class="autor">
                                <span><i class="icon-time"></i> @item.MsgTime.ToString("yyyy-MM-dd HH:mm")</span>
                                <span><i class="icon-comments"></i> 评论(<a href="@Url.Action("index","message")/#m_@item.ID">@item.MsgReplyModels.Count</a>)</span>
                                <span>
                                    <i class="icon-heart"></i> 赞(<a href="@Url.Action("index","message")#m_@item.ID">@item.AgreeCount</a>)
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            }
            <div class="see-more"><a href="@Url.Action("message")">查看更多</a></div>
        }
        else
        {
            if (UserSession.LoginUserInfo != null && UserSession.AccountId.Same(blogUser.Account))
            {
                <span class="dv-none-tip">暂无留言~现在去 <a href="@Url.Action("index","message")"><i class="icon-edit"></i>编辑主人寄语</a></span>
            }
            else
            {
                <span class="dv-none-tip">还没有人给他留言，我去抢个沙发 ~<a href="@Url.Action("index","message")">Go <i class="icon-circle-arrow-right"></i></a></span>
            }
        }
    </div>
    <div class="dright" id="blog-comm-right">
        @{Html.RenderAction("_BlogCommonRight"); }
    </div>
</div>
<script type="text/javascript">
    $(function () {
        @*if (@Request.Params["first"].ToString()=='1') {
            new jBox('Notice', {
                content: 'Hi，亲爱的新用户，欢迎注册小博客，赶紧体验一下各个功能把！',
                closeOnMouseleave: true,
                theme: 'TooltipBorder',
                attach:$('.amenu'),
                position:{x: 'right', y:40},
            });
        }*@

    })
</script>